/*
 * create:2016年4月11日 下午3:54:17
 * author:wangds  
 */
package com.cxkj.shop.biz.cart;

import javax.servlet.http.HttpSession;

import com.cxkj.shop.form.DefaultDelivery;
import com.cxkj.shop.form.Delivery;
import com.cxkj.shop.form.shoppingcart.ShoppingCartOpForm;
import com.cxkj.shop.model.shoppingcart.CommodityItem;
import com.cxkj.shop.model.shoppingcart.ShoppingCart;
import com.cxkj.shop.utils.BusinessUtils;

import net.wangds.comp.business.http.AbstractHttpInteractionBusiness;

/**
 * .
 * @author wangds
 *
 */
public class LookAtShoppingCartBusiness extends AbstractHttpInteractionBusiness<ShoppingCartOpForm, Delivery> {

  /*
   * @see net.wangds.common.processor.Processor#process()
   * @author wangds 2016年4月11日 下午3:55:13.
   */
  @Override
  public void process() throws Exception {
    DefaultDelivery<ShoppingCart> res = new DefaultDelivery<ShoppingCart>();
    HttpSession ssn = BusinessUtils.getHttpSessionFromHttpBusiness(this);
    ShoppingCart cart = BusinessUtils.getShoppingCartFromSession(ssn);
    
    res.setSuccess(true);
    res.setData(cart);
    res.setPostTs(System.currentTimeMillis());
    this.setOutput(res);
  }

  

  /**
   * .
   * @author wangds 2016年4月12日 上午11:53:17.
   * @param cur
   */
  @SuppressWarnings("unused")
  private void fillCommodityInfoByDemo(CommodityItem cur) {
    String id = cur.getCommodityId();
    int num_id = Integer.parseInt(id);
    
    switch(num_id){
    case 333:
      cur.setCommodityName("龙猫");
      cur.setMainImg("p1.png");
      cur.setPrice(1);
      break;
    case 444:
      cur.setCommodityName("榛子");
      cur.setMainImg("p2.png");
      cur.setPrice(1);
      break;
    case 555:
      cur.setCommodityName("泡芙");
      cur.setMainImg("p3.png");
      cur.setPrice(1);
      break;
    }
    
  }

}
